﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lxzhu.OpenGL;

namespace Tutorials
{
    /// <summary>
    /// 这个例子显示了如何利用OpenGL来绘制点.
    /// </summary>
    class PrimitivePoints:GlutEngine
    {
        static void Main(string[] args)
        {
            PrimitivePoints rt = new PrimitivePoints();
            rt.Run();
        }
        public override void OnDisplay()
        {
            base.OnDisplay();
            Gl.glClear(BufferBit.GL_COLOR_BUFFER_BIT);
            Gl.glClearColor(0,0,0,0);
            //如果不开启平滑点,那么启用这个能力.
            if (!Gl.glIsEnabled(Gl.GL_POINT_SMOOTH))
                Gl.glEnable(Gl.GL_POINT_SMOOTH);
            //查询最大的点size.
            float[] sizeRange=new float[1];
            Gl.glGetFloatv(Gl.GL_POINT_SIZE_MIN, sizeRange);
            ErrorCode code = Gl.glGetError();
            Gl.glPointSize(10);           
            Gl.glBegin(PrimitiveType.GL_POINTS);
            //指定点的颜色
            Gl.glColor(0.0f, 0, 1.0f);
            Gl.glVertex(0.5f, 0.5f, 0.0);            
            Gl.glVertex(0.4f, 0.4f, 0.0);
            Gl.glEnd();
           
        }
    }
}
